﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;

namespace Ewk.Math.Algebra.UnitTests.MatrixTests.DoubleTests
{
    [TestClass]
    public class AdjugateTests : DoubleTestBase
    {
        [TestMethod]
        public void Adjugate_uses_an_IAdjugateComputer_every_time_to_compute_the_adjugate_of_the_matrix_and_returns_the_value_that_is_returned_by_the_IAdjugateComputer()
        {
            var matrix1 = Identity;
            var mockedMatrix = Matrix;

            AdjugateComputer
                .Expect(
                    computer =>
                    computer.ComputeAdjugate(matrix1))
                .Return(mockedMatrix)
                .Repeat.Twice();
            AdjugateComputer.Replay();

            var result1 = matrix1.Adjugate();
            var result2 = matrix1.Adjugate();

            Assert.AreEqual(mockedMatrix, result1);
            Assert.AreEqual(mockedMatrix, result2);

            AdjugateComputer.VerifyAllExpectations();
        }
    }
}